package com.example.demo.entity;

import com.example.demo.handler.JsonTypeHandlerPg;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import org.postgresql.geometric.PGpoint;

import java.io.Serial;
import java.time.LocalDate;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户 实体类。
 *
 * @author Administrator
 * @since 2024-12-06
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("用户")
@Table("t_user")
public class User implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @Id(keyType = KeyType.Generator, value = "snowFlakeId")
    @ApiModelProperty("ID")
    private Long id;

    /**
     * 姓名
     */
    @ApiModelProperty("姓名")
    private String name;

    /**
     * 年龄
     */
    @ApiModelProperty("年龄")
    private Integer age;

    /**
     * 生日
     */
    @ApiModelProperty("生日")
    private LocalDate birthday;

    /**
     * 用户名
     */
    @ApiModelProperty("用户名")
    private String userName;

    /**
     * 创建时间
     */
    @Column(onInsertValue = "now()")
    @ApiModelProperty("创建时间")
    private Timestamp createTime;

    /**
     * 朋友
     */
    @ApiModelProperty("朋友")
    @Column(typeHandler = JsonTypeHandlerPg.class)
    private String friends;

    /**
     * 位置坐标
     */
    @ApiModelProperty("位置坐标")
    private PGpoint position;

    /**
     * 乐观锁
     */
    @Column(version = true)
    @ApiModelProperty("乐观锁")
    private Integer version;

    /**
     * 删除
     */
    @Column(isLogicDelete = true)
    @ApiModelProperty("删除")
    private Integer deleted;

    /**
     * 修改时间
     */
    @Column(onUpdateValue = "now()")
    @ApiModelProperty("修改时间")
    private Timestamp updateTime;

}
